package com.hzj.rtsp.task;


import com.hzj.rtsp.dto.Video;

/**
 * Created by Hzj on 2021/5/25.
 */
public class VideoUtil {

    public static String getRTSPUrl(Video video){
        String url="";
        if(video.getBrand()==1) {//海康
              url = "rtsp://" + video.getUsername() + ":" + video.getPassword() + "@" + video.getIp() + ":" + video.getRtspport() + "/Streaming/Channels/" + video.getVideoChannel() + "0" + video.getStreamtype() + "?transportmode=unicast";
        }else  if(video.getBrand()==2) {//大华
            url = "rtsp://" + video.getUsername() + ":" + video.getPassword() + "@" + video.getIp() + ":" + video.getRtspport() + "/cam/realmonitor?channel=" + video.getVideoChannel() + "&subtype=" + (video.getStreamtype()-1) + "";
        }
        return url;
    }
    //回放地址
    public static String getRTSPPlayBackUrl(Video video){
        String  url= "rtsp://"+video.getUsername()+":"+video.getPassword()+"@"+video.getIp()+":"+video.getRtspport()+"/Streaming/tracks/"+ video.getVideoChannel() +"0"+video.getStreamtype()+"";
        return url;
    }
}
